package com.yjhb.android.sbz.enums;

/**
 * 创建者 zx
 * 创建时间 2020/12/18 9:28
 * <p>
 * 用于表示接取任务一系列状态
 */
public enum TaskStatus {
    TASK_STATUS_UNKNOWN(-99, "未知状态"),
    TASK_STATUS_ERR(-2, "异常"),
    TASK_STATUS_UN(-1, "未接取"),
    TASK_STATUS_TAKE(0, "已接取"),
    TASK_STATUS_SUBMIT(1, "已提交"),
    TASK_STATUS_PASS(2, "已通过"),
    TASK_STATUS_FAIL(3, "已失败"),
    TASK_STATUS_CANCEL(4, "已取消"),
    TASK_STATUS_TIMEOUT(5, "已超时"),
    TASK_STATUS_RESUBMIT(6, "重新提交"),
    TASK_STATUS_DISPUTE(7, "存在争议");


    TaskStatus(int status, String statusStr) {
        this.statusStr = statusStr;
        this.status = status;
    }

    private int status;
    private String statusStr;


    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    public String getStatusStr() {
        return statusStr;
    }

    public void setStatusStr(String statusStr) {
        this.statusStr = statusStr;
    }

    public static TaskStatus getStatus(Integer status) {
        switch (status) {
            case -2:
                return TASK_STATUS_ERR;
            case -1:
                return TASK_STATUS_UN;
            case 0:
                return TASK_STATUS_TAKE;
            case 1:
                return TASK_STATUS_SUBMIT;
            case 2:
                return TASK_STATUS_PASS;
            case 3:
                return TASK_STATUS_FAIL;
            case 4:
                return TASK_STATUS_CANCEL;
            case 5:
                return TASK_STATUS_TIMEOUT;
            case 6:
                return TASK_STATUS_RESUBMIT;
            case 7:
                return TASK_STATUS_DISPUTE;
            default:
                return TASK_STATUS_UNKNOWN;
        }
    }

}
